<?php
/*
 * @version :  2013-4-22
 * @project :  account-system
 * @Author  :  Allen
 * @e-mail  :  shulei@maszy.cn
 */
 require_once (dirname(__FILE__)."/../config/config.php");
 $content = getXml();

outPutXml($content);
function getXml(){
	$content = "";
	if(isset($_REQUEST['mac'])){
		$sql1="select * from zy_equipment  where MacAddress='".$_REQUEST['mac']."'";
		$rss = mysql_query($sql1);
		$rows = mysql_fetch_array($rss);
		$sqlpackage = "select * from zy_user_service where user_id='".$rows['updater']."' and service_id = 14";
		$rsult = mysql_query($sqlpackage);
		$rowsrs = mysql_fetch_array($rsult);
		
		//zy_equipment 通过mac地址查询userid update
		$sql="SELECT * FROM zy_tvshow  ORDER BY sort ASC";
		$rs = mysql_query($sql);
		
		while($row = mysql_fetch_array($rs)){
			 		 	$content.= "<result>\n";
						$content.= "<channellistid >".$row['tv_id']."</channellistid >\n";
						$content.= "<description>".$row['tv_name']."</description>\n";
						$content.= "<restriction>".$row['is_limit']."</restriction>\n";
						$content.= "</result>\n";
		}
	}
	return $content;
}

function outPutXml($content) {
	header("Content-type:text/xml");
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n";
	echo "<netcuberesult>\n";
	echo $content;
	echo "</netcuberesult>";
	die();
}
